<?php

/**
 * Content form.
 *
 * @package    vogue
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class NewsForm extends BaseNewsForm
{
  public function configure()
  {
      unset($this['id'],$this['created_at'], $this['is_featured'], $this['nb_views'], $this['additional']);
    
    	# WIDGETS
    	$choices = Doctrine::getTable('BbSeason')->fetcharray();
      $this->widgetSchema['season_id']   = new sfWidgetFormChoice(array('choices'=>$choices), array('style'=>'width:400px;height:24px;', 'onchange'=>'loadObjects();'));
    	$types = myConstants::getGalleryTypes();
    	$this->widgetSchema['object_type'] = new sfWidgetFormChoice(array('choices'=>$types), array('style'=>'width:400px;height:24px;', 'onchange'=>'loadObjects();'));
    	$categories = Doctrine::getTable('Category')->fetchArray();
    	$this->widgetSchema['category_id'] = new sfWidgetFormChoice(array('choices'=>$categories), array('style'=>'width:400px;height:24px;'));
      $this->widgetSchema['title']       = new sfWidgetFormInputText(array(), array('style'=>'width:400px;'));
      $this->widgetSchema['image']       = new sfWidgetFormInputFile(array(), array());
      $this->widgetSchema['intro']       = new sfWidgetFormTextarea(array(), array('style'=>'width:400px;'));
    	#$this->widgetSchema['content']        = new sfWidgetFormFCKEditor(array('width'=>800, 'height'=>300));
    	$this->widgetSchema['content']        = new sfWidgetFormTextarea(array(), array('style'=>'width:800px;height:300px;'));
    	$this->widgetSchema['sort']   		 = new sfWidgetFormInputText(array(), array('size'=>10));
    	
    	$this->setDefault('object_type', $this->getOption('object_type'));
    	
    	# VALIDATORS
    	$this->validatorSchema['object_id']   = new sfValidatorPass();
    	$this->validatorSchema['category_id'] = new sfValidatorPass();
    	$this->validatorSchema['title']       = new sfValidatorString(array(), array());
    	$this->validatorSchema['intro']  	    = new sfValidatorPass();
    	$this->validatorSchema['content']        = new sfValidatorPass();
    	$this->validatorSchema['sort']  	    = new sfValidatorPass();
    	$this->validatorSchema['image']       = new sfValidatorFile(
                                                  array('required' => false,
                                                      'path'       => sfConfig::get("sf_upload_dir")."/news",
                                                      'max_size'   => 209715200,
                                                      'mime_types' =>  array('image/jpeg','image/pjpeg','image/png','image/x-png','image/gif',)),
                                                  array(
                                                      'max_size'   => 'Файлын хэмжээ хамгийн ихдээ 20MB байна',
                                                      'mime_types' => 'Дараах өргөтгөлтэй файлууд зөвшөөрөгдөнө: jpg, png, gif'));


      $this->widgetSchema->setHelp('image', '500x300px - png | gif | jpg');
  }
  

}